#include <stdio.h>

int HCF=0,LCF=0;

int Lcf (int x, int y){
    int r=x%y;
    while (r!=0){
        x = y;
        y = r;
        r = x%y;
    }
    return y;
}

int Hcf (int x, int y){
    int r=Lcf(x,y);
    return x*y/r;
}

void getLCF(int x, int y){
    LCF = Lcf(x,y);
}

void getHCF(int x, int y){
    if (!LCF) getLCF(x,y);
    HCF = x*y/LCF;
}

int main(){
    // 求最大公约、最小公倍数
    int n,m;
    printf("input:");
    scanf("%d %d",&n,&m);
    printf("lcf:%d\thcf:%d\n",Lcf(n,m),Hcf(n,m));
    getHCF(n,m);
    printf("lcf:%d\thcf:%d\n",LCF,HCF);
    return 0;
}